<template>
  <div style="height: 100%;overflow:hidden">
    <x-header :left-options="{preventGoBack:true,backText: ''}" @on-click-back="backhome">日常巡检单查看</x-header>
    <div class="main-container" style="height:93%">
      <v-touch v-on:swiperight="onSwipeRight" :swipe-options="{direction: 'horizontal'}">
        <div style="margin-bottom: 30px;">
          <group>
            <cell title="项目（部）" v-model="pro"></cell>
            <cell v-model="subject" title="任务名称"></cell>
            <cell title="要求整改日期" v-model="checkStartDate"></cell>
            <cell title="整改完成日期" v-model="checkEndDate"></cell>
          </group>
          <group title="问题图片">
            <div v-for="(item,index) in imgList" :key="index" style="display:flex;flex-direction: row"
              v-viewer="{toolbar: false, navbar: false}">
              <img :src="item" style="width:60px;height:60px" />
            </div>
          </group>
          <group title="整改图片">
            <picture-upload :fieldToken2="ATTACHMENTS2" :pageToken="ATTACHMENTS2" :value="ATTACHMENTS2"
              :readonly="true"></picture-upload>
          </group>
          <group title="检查情况">
            <x-textarea placeholder="请输入一段描述" v-model="DESCRIPTION" readonly></x-textarea>
          </group>
          <group>
            <cell title="签发人" v-model="name"></cell>
            <cell title="签发人部门" v-model="dept"></cell>
            <cell title="检查组员" v-model="inspectMemberFullName"></cell>
            <cell title="发起日期" v-model="inputDate"></cell>
            <x-switch title="短信通知" v-model="notifyMethod" :value-map="['0,1,0','0,0,0']" disabled></x-switch>
            <cell title="整改负责人" v-model="reformer"></cell>
            <cell title="检查人" v-model="checkPerson"></cell>
            <cell title="监理负责人" v-model="superviorFullName"></cell>
            <!-- <cell title="检查意见" v-model="flag"></cell> -->
          </group>
          <group title="整改描述">
            <x-textarea placeholder="请输入一段描述" v-model="option" readonly></x-textarea>
          </group>
          <group style="padding:0 10px 0 10px">
            <flexbox style="margin-top:20pt">
              <flexbox-item>
                <x-button type="warn" @click.native="deleteRecode">删除</x-button>
              </flexbox-item>
              <flexbox-item>
                <x-button @click.native="saveInspectionInfo">上传</x-button>
              </flexbox-item>
            </flexbox>
            <Toast :value="toastValue" :is-show-mask="true" text="保存成功" @on-hide="saveSuccess"></Toast>
            <Toast :value="toastValueErr" :is-show-mask="true" :text="err" @on-hide="saveErr" type="cancel"
              width="200px"></Toast>
          </group>
        </div>
      </v-touch>
    </div>
  </div>
</template>

<script>
  import * as L from "leaflet";
  import Vue from "vue";
  //Vue.L = Vue.prototype.$L = L
  import {
    Group,
    Cell,
    XButton,
    Box,
    GroupTitle,
    Flexbox,
    FlexboxItem,
    Divider,
    Calendar,
    PopupPicker,
    Toast,
    XSwitch,
    Loading
  } from "vux";
  import {
    debug
  } from "util";
  // import { TIMEOUT } from 'dns';
  var map = null;
  var marker = null;
  export default {
    components: {
      XButton,
      Box,
      GroupTitle,
      Group,
      Flexbox,
      FlexboxItem,
      Divider,
      Group,
      Cell,
      Calendar,
      PopupPicker,
      Toast,
      XSwitch,
      Loading
    },
    name: "offlinechecklistdetial",
    data() {
      return {
        //   msg: 'Welcome to Your Vue.js App',
        pro: "",
        proId: this.$route.query.proId,
        GUID: this.$route.query.GUID,
        centerPosition: this.$route.query.site,
        site: this.$route.query.site,
        name: "",
        phone: "",
        dept: "",
        DESCRIPTION: "",
        pageToken: "",
        fieldToken: "",
        buttonid: "",
        fieldToken2: "",
        // map:"",
        checkerid: "",
        checkDate: "",
        name: "",
        phone: "",
        dept: "",
        inputDate: "",
        ATTACHMENTS: "",
        ATTACHMENTS2: "",
        fileNameItem: [],
        notifyMethod: "",
        subject: "",
        checkStartDate: "",
        checkEndDate: "",
        reformer: "",
        option: "",
        flag: "",
        offlineUrl: [],
        toastValueErr: false,
        toastValue: false,
        data: [],
        imgList: this.$store.state.offlineflieurl, //本地图片存储路径
        err: "",
        successFlag: 0,
        checkPerson: "",
        inspectMemberFullName: "",
        inspectMemberName: "",
        supervisorFullName: "",
        supervisorName: ""
      };
    },
    methods: {
      saveSuccess() {
        this.backhome();
      },
      saveErr() {
        this.toastValueErr = false;
      },
      deleteRecode() {
        const _this = this;
        this.$vux.confirm.show({
          // 组件除show外的属性
          title: "提示",
          content: "确认删除？",
          onCancel() {},
          onConfirm() {
            _this.$store.state.SQLiteDB.transaction(tx => {
              tx.executeSql(
                'DELETE FROM PMHSE_CHECKLIST WHERE GUID = "' + _this.GUID + '"'
              );
            });
            _this.backhome();
          }
        });
      },
      //上传文件
      upload(fileURL, guid) {
        console.log("upload:" + fileURL);
        var success = r => {
          //上传成功
          console.log("传上成功");
          console.log("rrrrrrr", r);

          this.imgList.map(item => {
            if (true) {
              // if (this.belongSubSys != '') {
              item.fileOldName = JSON.parse(r.response)[0].name;
              item.fileId = JSON.parse(r.response)[0].id;
              item.fieldToken = JSON.parse(r.response)[0].fieldToken;
              item.size = JSON.parse(r.response)[0].size;
              // } else if (this.server != '') {
              // item.fileId = JSON.parse(r.response).fileId // moaapi/feedback 接口
              // }
            }
          });
          //判断图片上传成功数量
          this.successFlag++;
          //若图片上传成功数量和本地已存储的图片数量相等则进行上传表单操作
          if (this.successFlag == this.offlineUrl.length) {
            //发送系统消息
            var guid = this.guid();
            var title = "日常巡检单提醒";
            var content =
              "你管理的" +
              this.pro +
              "项目有一个新的日常巡检单单。请进入【日常巡检】查看详细信息。";
            var messageto = this.supervisorName;
            var url =
              process.env.BASE_URL +
              "qhszpm/forms/SM/SAFECHECKINSPECT/SAFECHECKINSPECT_Add.html?isBreak=false&objName=SAFECHECKINSPECT&_useType=view&_pk=GUID&_t=474914&_winid=w5240&_pkValue=" +
              guid;

            var sendParams = {
              _method: "SYS_NOTICE.sendNotice",
              _param: {
                messageto: messageto,
                messagetilte: title,
                messagecontent: content,
                url: url,
                messagesenttime: new Date(),
                messageattachment: ""
              }
            };
            let sendJson = {
              FixJSON: JSON.stringify(sendParams)
            };
            this.$ajax({
                url: this.COMMON_URL,
                method: "post",
                // data: this.signMD5(sendJson)
                data: sendJson
              })
              .then(res => {})
              .catch(err => {
                console.log(err);
              });
            var params = {
              _method: "formService.saveFormData",
              requestEventData: {
                eventType: "formSubmitEvent",
                formType: 1,
                bizObjId: "SAFECHECKINSPECT",
                formId: "SAFECHECKINSPECT_Add",
                buttonId: "HandleCommand_1"
              },
              flowParam: {
                defKey: "SAFECHECKINSPECT",
                nodeId: "UserTask_1",
                userCommandType: "startandsubmit",
                userCommandId: "HandleCommand_1",
                isAdmin: "false",
                taskComment: "",
                extParam: {}
              },
              _OBJ_NAME_: "SAFECHECKINSPECT",
              _FORM_ID_: "SAFECHECKINSPECT_Add",
              useType: "add",
              pageToken: this.pageToken,
              formData: {
                objName: "SAFECHECKINSPECT",
                pks: ["GUID"],
                data: [{
                  rowData: [{
                      DataTarget: "GUID",
                      Value: guid,
                      OriginalValue: null,
                      PK: true,
                      DataType: "String"
                    },
                    {
                      DataTarget: "STATE",
                      Value: "",
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "ATTACHMENTS",
                      Value: "",
                      OriginalValue: null,
                      PK: false,
                      DataType: "Store.ecidiDoc"
                    },
                    {
                      DataTarget: "ATTACHMENTS2",
                      Value: "",
                      OriginalValue: null,
                      PK: false,
                      DataType: "Store.ecidiDoc"
                    },
                    {
                      DataTarget: "PRJNAME",
                      Value: this.pro,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "PRJNO",
                      Value: null,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "SYSPRJID",
                      Value: this.proId,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "SUBJECT",
                      Value: this.subject,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "CHECKREQUIRED",
                      Value: this.DESCRIPTION,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "PLANDATE",
                      Value: this.checkStartDate + " 00:00:00.000",
                      OriginalValue: null,
                      PK: false,
                      DataType: "TimeStamp"
                    },
                    {
                      DataTarget: "FINISHDATE",
                      Value: "",
                      OriginalValue: null,
                      PK: false,
                      DataType: "TimeStamp"
                    },
                    {
                      DataTarget: "ATTACHMENTS",
                      Value: this.fieldToken,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "ATTACHMENTS2",
                      Value: "",
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "DESCRIPTION",
                      Value: "",
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "INPUTERFULLNAME",
                      Value: this.name,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "INPUTERNAME",
                      Value: this.userId,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "INPUTERDEPTNAME",
                      Value: this.dept,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "INPUTERDEPTID",
                      Value: this.deptId,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "PHONENUM",
                      Value: this.phone,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "INPUTDATE",
                      Value: this.inputDate,
                      OriginalValue: null,
                      PK: false,
                      DataType: "TimeStamp"
                    },
                    {
                      DataTarget: "NOTIFYCHECK",
                      Value: "",
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "NOTIFYMETHOD",
                      Value: this.notifyMethod,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "REFORMER",
                      Value: this.reformer,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "REFORMERID",
                      Value: this.data.REFORMERID,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "FLAG",
                      Value: "不合格",
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "CHECKER",
                      Value: this.checkPerson,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "CHECKERID",
                      Value: this.checkerid,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "SUPERVISORFULLNAME",
                      Value: this.supervisorFullName,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "SUPERVISORNAME",
                      Value: this.supervisorName,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "INSPECTMEMBERFULLNAME",
                      Value: this.inspectMemberFullName,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    },
                    {
                      DataTarget: "INSPECTMEMBERNAME",
                      Value: this.inspectMemberName,
                      OriginalValue: null,
                      PK: false,
                      DataType: "String"
                    }
                  ],
                  children: []
                }]
              },
              _ATTACHMENT_DELETE_IDS_: "",
              formInfo: {
                GUID: guid,
                STATE: "",
                ATTACHMENTS: this.fieldToken,
                ATTACHMENTS2: "",
                PRJNAME: this.pro,
                PRJNO: "",
                SYSPRJID: this.proId,
                SUBJECT: this.subject,
                CHECKREQUIRED: this.DESCRIPTION,
                PLANDATE: this.startDate,
                FINISHDATE: "",
                DESCRIPTION: "",
                INPUTERFULLNAME: this.name,
                INPUTERNAME: this.userId,
                INPUTERDEPTNAME: this.dept,
                INPUTERDEPTID: this.deptId,
                PHONENUM: this.phone,
                INPUTDATE: this.inputDate,
                NOTIFYCHECK: "",
                NOTIFYMETHOD: this.notifyMethod,
                REFORMER: this.reformer,
                REFORMERID: this.data.REFORMERID,
                FLAG: "不合格",
                CHECKER: this.checkPerson,
                CHECKERID: this.checkerid,
                INSPECTMEMBERFULLNAME: this.inspectMemberFullName,
                INSPECTMEMBERNAME: this.inspectMemberName,
                SUPERVISORFULLNAME: this.supervisorFullName,
                SUPERVISORNAME: this.supervisorName
              }
            };
            let json = {
              FixJSON: JSON.stringify(params)
            };

            this.$ajax({
                url: this.COMMON_URL +
                  "?_objName=SAFECHECKINSPECT&_useType=add&_defKey=Flow_SAFECHECKINSPECT&_pk=GUID&_pkValue=undefined",
                method: "post",
                data: json
              })
              .then(res => {
                if (res.status == 200) {
                  this.toastValue = true;
                  this.$store.state.SQLiteDB.transaction(
                    tx => {
                      tx.executeSql(
                        'DELETE FROM PMHSE_CHECKLIST WHERE GUID="' +
                        this.data.GUID +
                        '"'
                      );
                    },
                    err => {
                      console.log("错误", err);
                    }
                  );
                }
              })
              .catch(err => {
                //console.log(err);
                alert(err);
                //this.err='';
              });
          }
          // this.showPercent = false
          // this.percent = 0
          //  this.$emit('input', this.list)
          // this.show = false
        };
        var fail = error => {
          // 上传失败
          console.log(JSON.stringify(error));
          // //console.log('photoFailed')
          // this.showPercent = false
          // this.percent = 0
          // console.log("上传失败")
        };
        var options = new FileUploadOptions();
        console.log("fileUpload:" + options);
        options.fileKey = "fileName";
        options.fileName = fileURL.substr(
          fileURL.lastIndexOf("/"),
          fileURL.lastIndexOf("?") - fileURL.lastIndexOf("/")
        );
        if (!options.fileName) {
          options.fileName = fileURL.substr(fileURL.lastIndexOf("/"));
        }
        options.mimeType = "application/octet-stream";
        (options.httpMethod = "POST"),
        (options.headers = {
          Accept: "*/*",
          "Accept-Encoding:": "gzip, deflate",
          "Accept-Language": " zh-CN,zh;q=0.9",
          Connection: "keep-alive"
        });
        (options.chunkedMode = false),
        // 如果要传参数，写这里
        (options.params = {
          Filename: fileURL.substr(fileURL.lastIndexOf("/") + 1),
          Upload: "Submit Query"
          // modularName: 'CNL',
          // allowType: 'jpeg;jpg;png;pdf;doc;xls;xlsx;docx',
        });
        var ft = new FileTransfer();
        //注册监听上传进度
        ft.onprogress = progressEvent => {
          if (progressEvent) {
            this.percent = Math.round(
              (progressEvent.loaded * 100) / progressEvent.total
            );
          }
        };
        let params =
          "type=customerDownloadService&FixJSON={%27_method%27:%27streamSupportService.saveTempAttachment%27,%27_param%27:{pageToken:%27" +
          this.pageToken +
          "%27,fieldToken:%27" +
          this.fieldToken +
          "%27,datatype:%27Store.ecidiDoc%27}}";
        if (device.platform == "iOS") {
          // params =
          // "type=customerDownloadService&FixJSON={%27_method%27:%27streamSupportService.saveTempAttachment%27,%27_param%27:{pageToken:%27" +
          // this.pageToken + "%27,fieldToken:%27" + this.fieldToken + "%27,datatype:%27Store.ecidiDoc%27}}"
          params =
            "type=customerDownloadService&FixJSON={'_method':'streamSupportService.saveTempAttachment','_param':{'pageToken':'" +
            this.pageToken +
            "','fieldToken':'" +
            this.fieldToken +
            "',datatype:'Store.ecidiDoc'}}";
        }
        //'type=%27customerDownloadService%27&FixJSON=%7B%27_method%27:%27streamSupportService.saveTempAttachment%27,%27_param%27:%7B%27pageToken%27:%27' +
        //  this.pageToken + '%27,%27fieldToken%27:%27' + this.fieldToken + '%27%7D%7D'

        //上传地址
        let SERVER = "";
        // if (this.belongSubSys != '') {
        SERVER =
          this.COMMON_URL.replace("Action.cmd", "StreamSupportAction.cmd") +
          "?" +
          params;
        // }
        // console.log('开始上传'+SERVER)
        // if (this.server != '') {
        //   SERVER = this.server
        //   params = this.params == '' ? '' : this.params
        // }
        console.log("开始上传" + SERVER);
        if (device.platform == "iOS") {
          SERVER = encodeURI(SERVER);
        }
        console.log("optionoffline", options);
        console.log(fileURL);
        ft.upload(fileURL, SERVER, success, fail, options);
      },
      onSwipeRight() {
        this.$router.push("/offlineCklist");
      },
      backhome() {
        this.$router.push("/offlineCklist");
      },
      //下载附件
      checkFile(fileId, name, size) {
        var url =
          "http://qhsz.simulate.com:8080/qhszpm/servlet/StreamSupportAction.cmd?type=%27customerDownloadService%27&FixJSON=%7B_method%3A%27streamSupportService.getAttachment%27%2C_param%3A%7BattachmentId%3A" +
          fileId +
          "%7D%7D";

        this.$router.push({
          path: "/fileInfo",
          name: "fileInfo",
          params: {
            name: name,
            size: size,
            url: url
          }
        });
      },
      getDetailInfo() {
        this.$store.state.SQLiteDB.transaction(tx => {
          tx.executeSql(
            'SELECT * FROM PMHSE_CHECKLIST WHERE GUID ="' + this.GUID + '"',
            [],
            (tx, result) => {
              console.log("详情结果", result);
              this.data = result.rows.item(0);
              this.subject = this.data.SUBJECT;
              this.checkStartDate = this.data.PLANDATE;
              this.checkEndDate = this.data.FINISHDATE;
              this.ATTACHMENTS = this.data.ATTACHMENTS;
              this.ATTACHMENTS2 = this.data.ATTACHMENTS2;
              this.DESCRIPTION = this.data.CHECKREQUIRED;
              this.name = this.data.INPUTERFULLNAME;
              this.dept = this.data.INPUTERDEPTNAME;
              this.inputDate = this.data.INPUTDATE;
              this.notifyMethod = this.data.NOTIFYMETHOD;
              this.reformer = this.data.REFORMER;
              this.option = this.data.DESCRIPTION;
              this.flag = this.data.FLAG;
              this.pro = this.data.PRJNAME;
              this.proId = this.data.SYSPRJID;
              this.userId = this.data.INPUTERNAME;
              this.deptId = this.data.INPUTERDEPTID;
              this.phone = this.data.PHONENUM;
              this.checkerid = this.data.CHECKERID;
              this.inspectMemberFullName = this.data.INSPECTMEMBERFULLNAME;
              this.inspectMemberName = this.data.INSPECTMEMBERNAME;
              this.checkPerson = this.data.CHECKER;
              this.supervisorFullName = this.data.SUPERVISORFULLNAME;
              this.supervisorName = this.data.SUPERVISORNAME;
              let res = this.data.FILEURL;
              res = res.replace(/\|\|/g, ".");
              this.offlineUrl = res.split(",");
            }
          );
        });
      },
      saveInspectionInfo() {
        //  Vue.$vux.loading.show({
        //       text : "Loading"
        //     })
        console.log(this.imgList);
        this.fieldToken = this.data.ATTACHMENTS;
        if (this.imgList.length == 0) {
          //发送系统消息
          var guid = this.guid();
          var title = "日常巡检单提醒";
          var content =
            "你管理的" +
            this.pro +
            "项目有一个新的日常巡检单单。请进入【日常巡检】查看详细信息。";
          var messageto = this.supervisorName;
          var url =
            process.env.BASE_URL +
            "qhszpm/forms/SM/SAFECHECKINSPECT/SAFECHECKINSPECT_Add.html?isBreak=false&objName=SAFECHECKINSPECT&_useType=view&_pk=GUID&_t=474914&_winid=w5240&_pkValue=" +
            guid;

          var sendParams = {
            _method: "SYS_NOTICE.sendNotice",
            _param: {
              messageto: messageto,
              messagetilte: title,
              messagecontent: content,
              url: url,
              messagesenttime: new Date(),
              messageattachment: ""
            }
          };
          let sendJson = {
            FixJSON: JSON.stringify(sendParams)
          };
          this.$ajax({
              url: this.COMMON_URL,
              method: "post",
              // data: this.signMD5(sendJson)
              data: sendJson
            })
            .then(res => {})
            .catch(err => {
              console.log(err);
            });
          var params = {
            _method: "formService.saveFormData",
            requestEventData: {
              eventType: "formSubmitEvent",
              formType: 1,
              bizObjId: "SAFECHECKINSPECT",
              formId: "SAFECHECKINSPECT_Add",
              buttonId: "HandleCommand_1"
            },
            flowParam: {
              defKey: "SAFECHECKINSPECT",
              nodeId: "UserTask_1",
              userCommandType: "startandsubmit",
              userCommandId: "HandleCommand_1",
              isAdmin: "false",
              taskComment: "",
              extParam: {}
            },
            _OBJ_NAME_: "SAFECHECKINSPECT",
            _FORM_ID_: "SAFECHECKINSPECT_Add",
            useType: "add",
            pageToken: this.pageToken,
            formData: {
              objName: "SAFECHECKINSPECT",
              pks: ["GUID"],
              data: [{
                rowData: [{
                    DataTarget: "GUID",
                    Value: guid,
                    OriginalValue: null,
                    PK: true,
                    DataType: "String"
                  },
                  {
                    DataTarget: "STATE",
                    Value: "",
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "ATTACHMENTS",
                    Value: "",
                    OriginalValue: null,
                    PK: false,
                    DataType: "Store.ecidiDoc"
                  },
                  {
                    DataTarget: "ATTACHMENTS2",
                    Value: "",
                    OriginalValue: null,
                    PK: false,
                    DataType: "Store.ecidiDoc"
                  },
                  {
                    DataTarget: "PRJNAME",
                    Value: this.pro,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "PRJNO",
                    Value: null,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "SYSPRJID",
                    Value: this.proId,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "SUBJECT",
                    Value: this.subject,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "CHECKREQUIRED",
                    Value: this.DESCRIPTION,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "PLANDATE",
                    Value: this.checkStartDate + " 00:00:00.000",
                    OriginalValue: null,
                    PK: false,
                    DataType: "TimeStamp"
                  },
                  {
                    DataTarget: "FINISHDATE",
                    Value: "",
                    OriginalValue: null,
                    PK: false,
                    DataType: "TimeStamp"
                  },
                  {
                    DataTarget: "ATTACHMENTS",
                    Value: this.fieldToken,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "ATTACHMENTS2",
                    Value: "",
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "DESCRIPTION",
                    Value: "",
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "INPUTERFULLNAME",
                    Value: this.name,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "INPUTERNAME",
                    Value: this.userId,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "INPUTERDEPTNAME",
                    Value: this.dept,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "INPUTERDEPTID",
                    Value: this.deptId,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "PHONENUM",
                    Value: this.phone,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "INPUTDATE",
                    Value: this.inputDate,
                    OriginalValue: null,
                    PK: false,
                    DataType: "TimeStamp"
                  },
                  {
                    DataTarget: "NOTIFYCHECK",
                    Value: "",
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "NOTIFYMETHOD",
                    Value: this.notifyMethod,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "REFORMER",
                    Value: this.reformer,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "REFORMERID",
                    Value: this.data.REFORMERID,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "FLAG",
                    Value: "不合格",
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "CHECKER",
                    Value: this.checkPerson,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "CHECKERID",
                    Value: this.checkerid,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "SUPERVISORFULLNAME",
                    Value: this.supervisorFullName,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "SUPERVISORNAME",
                    Value: this.supervisorName,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "INSPECTMEMBERFULLNAME",
                    Value: this.inspectMemberFullName,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  },
                  {
                    DataTarget: "INSPECTMEMBERNAME",
                    Value: this.inspectMemberName,
                    OriginalValue: null,
                    PK: false,
                    DataType: "String"
                  }
                ],
                children: []
              }]
            },
            _ATTACHMENT_DELETE_IDS_: "",
            formInfo: {
              GUID: guid,
              STATE: "",
              ATTACHMENTS: this.fieldToken,
              ATTACHMENTS2: "",
              PRJNAME: this.pro,
              PRJNO: "",
              SYSPRJID: this.proId,
              SUBJECT: this.subject,
              CHECKREQUIRED: this.DESCRIPTION,
              PLANDATE: this.startDate,
              FINISHDATE: "",
              DESCRIPTION: "",
              INPUTERFULLNAME: this.name,
              INPUTERNAME: this.userId,
              INPUTERDEPTNAME: this.dept,
              INPUTERDEPTID: this.deptId,
              PHONENUM: this.phone,
              INPUTDATE: this.inputDate,
              NOTIFYCHECK: "",
              NOTIFYMETHOD: this.notifyMethod,
              REFORMER: this.reformer,
              REFORMERID: this.data.REFORMERID,
              FLAG: "不合格",
              CHECKER: this.checkPerson,
              CHECKERID: this.checkerid,
              INSPECTMEMBERFULLNAME: this.inspectMemberFullName,
              INSPECTMEMBERNAME: this.inspectMemberName,
              SUPERVISORFULLNAME: this.supervisorFullName,
              SUPERVISORNAME: this.supervisorName
            }
          };
          let json = {
            FixJSON: JSON.stringify(params)
          };

          this.$ajax({
              url: this.COMMON_URL +
                "?_objName=SAFECHECKINSPECT&_useType=add&_defKey=Flow_SAFECHECKINSPECT&_pk=GUID&_pkValue=undefined",
              method: "post",
              data: json
            })
            .then(res => {
              if (res.status == 200) {
                this.toastValue = true;
                this.$store.state.SQLiteDB.transaction(
                  tx => {
                    tx.executeSql(
                      'DELETE FROM PMHSE_CHECKLIST WHERE GUID="' +
                      this.data.GUID +
                      '"'
                    );
                  },
                  err => {
                    console.log("错误", err);
                  }
                );
              }
            })
            .catch(err => {
              //console.log(err);
              alert(err);
              //this.err='';
            });
        } else {
          for (var j = 0; j < this.offlineUrl.length; j++) {
            this.upload(this.offlineUrl[j], this.imgList[j].guid);
          }
        }
      }
    },
    mounted() {
      this.getDetailInfo();
    },
    watch: {}
  };

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  /* .transition-view /deep/.weui-cells__title {
      margin-top: 0.77em;
    margin-bottom: 0.3em;
    padding-left: 15px;
    padding-right: 15px;
    color: #353535;
    font-size: 14px;
} */
  .transition-view /deep/ .vux-header .vux-header-left .left-arrow:before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid rgba(0, 0, 0, 0.8);
    border-width: 1px 0 0 1px;
    -webkit-transform: rotate(315deg);
    transform: rotate(315deg);
    top: 8px;
    left: 7px;
  }

  /* .transition-view /deep/ .vux-header .vux-header-title {
  line-height: 40px;
  text-align: center;
  font-size: 18px;
  font-weight: 400;
  color: #333;
} */
  #map {
    width: 100%;
    height: 25%;
  }

  .content {
    width: 100%;
    height: 75%;
  }

  .file {
    display: flex;
    align-items: center;
    position: relative;
    padding-bottom: 16px;
  }

  .file-icon {
    width: 16px;
    height: 16px;
  }

  .file-name {
    margin-left: 16px;
    font-size: 12px;
    color: #343434;
  }

  .file-size {
    font-size: 11px;
    color: #9f9f9f;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
  }

</style>
